const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}
module.exports = {
  outputDir: 'dist',
  assetsDir: 'static',
  indexPath: 'index.html',

  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [path.resolve(__dirname, "./src/assets/css/common.less")] // 引入全局样式变量
    }
  },
  css: {
    extract: true,
    sourceMap: false,
    loaderOptions: {
      less: {
        globalVars: {
          primary: 'rgba(26, 144, 255, 0.8)'
        }
      },
    },

    modules: false
  },
  devServer: {
    port: 80,
    proxy: {
      '/api': {
        target: 'http://dingrun.xyz:8890/youhelp', //接口域名
        changeOrigin: true,             //是否跨域
        ws: true,                       //是否代理 websockets
        secure: true,                   //是否https接口
        pathRewrite: {                  //路径重置
          '^/api': ''
        }
      },
      '/img': {
        target: 'https://sm.ms/api/v2', //接口域名
        changeOrigin: true,             //是否跨域
        ws: true,                       //是否代理 websockets
        secure: true,                   //是否https接口
        pathRewrite: {                  //路径重置
          '^/img': ''
        }
      }
    }
  }
};